using System.Xml.Serialization;
using CodePlex.DnD4eCampaignManager.DnD4e;
using CodePlex.DnD4eCampaignManager.DnD4e.Interfaces;

namespace CodePlex.DnD4eCampaignManager.Repositories.XmlRepositories
{
    public class StoryArcXmlRepository : BaseXmlRepository<IStoryArc>, IStoryArcRepository
    {
        private readonly string _campaignName;
        private static readonly XmlSerializer _xmlSerializer = new XmlSerializer(typeof ( StoryArc ));

        public StoryArcXmlRepository(string campaignName)
        {
            _campaignName = campaignName;
            InitializeRepository();
        }

        protected override string Extension
        {
            get { return ".arc"; }
        }

        protected override string Folder
        {
            get { return _campaignName; }
        }

        protected override XmlSerializer XmlSerializer
        {
            get { return _xmlSerializer; }
        }

        public IStoryArc CampaignRootArc()
        {
            return GetByName(_campaignName);
        }
    }
}